package com.ques.config;

import com.ques.entity.MailMessage;
import com.ques.utils.MailUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @author zq  2020-02-09
 */

@Configuration
public class EmailCodeConfig {
    @Value("${email.authUser}")
    private String authUser;
    @Value("${email.authPassword}")
    private String authPassword;
    @Value("${email.smtpHost}")
    private String smtpHost;
    @Value("${email.subject}")
    private String subject;
    @Value("${email.logoImg}")
    private String logoImg;


    @Bean
    public MailUtil mailUtil() {
        return new MailUtil();
    }

    @Bean
    @Scope("prototype")
    public MailMessage mailMessage() {
        MailMessage mailMessage = new MailMessage();
       return mailMessage.authUser(authUser)
                .authPassword(authPassword)
                .smtpHost(smtpHost)
                .subject(subject) ;
    }
}
